<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			.insert {
				width: 400px;
				height: 300px;
				margin: 0 auto;
				text-align: center;
				padding-top: 10px;
			}
			
			.title {
				line-height: 40px;
				margin-bottom: 20px;
			}
			
			.black {
				font-size: 25px;
				float: right;
			}
			
			.main {
				width: 260px;
				text-align: left;
				margin: 0 auto;
			}
			
			.marginLeft {
				margin-left: 25px;
			}
		</style>
	</head>

	<body>
		<div class="insert">
			<div class="title">
				用户信息
			</div>
			<div class="main">
				<p>姓名：<input type="text" name="username" id="username1" value="" /></p>
				<p>年龄：<input type="text" name="age" id="age" value="" /></p>
				<p>性别：<input type="text" name="sex" id="sex" value="" /></p>
				<p>邮箱：<input type="email" name="email" id="email" value="" /></p>
				<p>电话：<input type="phone" name="phone" id="phone" value="" /></p>
				<p><button class="" type="button" data-dismiss="modal">关闭</button></p>
			</div>
		</div>
		<script src="../static/js/jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			$(function() {
				var name = localStorage.getItem("name");
				console.log(name);
				$.ajax({
					type: "post",
					url: "php/changeSql.php?action=name",
					data: {
						name: name
					},
					success: function(data) {
						console.log(data);
						var result = JSON.parse(data);
						if(result.code == 1) {
							arr.push("<tr>");
								arr.push("<td colspan='5'>" + result.msg.id + "</td>");
								
								arr.push("</tr>");
						} else {
							$("#table_id_example tbody").remove();
							var arr = [];
							for(var i = 0; i < result.length; i++) {
								arr.push("<tr>");
								arr.push("<td>" + result.msg.id + "</td>");
								arr.push("<td>" + result.msg.name + "</td>");
								arr.push("<td>" + result.msg.age + "</td>");
								arr.push("<td>" + result.msg.email + "</td>");
								arr.push("<td>" + result.msg.phone + "</td>");
								arr.push("</tr>");
							}
							$('#table_id_example').append(arr.join());
						}
					}
				});
			});
		</script>
	</body>

</html>